package com.api.shopapi.mapper;

import com.api.shopapi.entity.MeshDeviceProperties;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface MeshDevicePropertiesMapper {

    @Insert("insert into mesh_device_properties (PropertiesCode,DeviceCode,Name,Value,UpdateTime) values " +
            "(#{meshDeviceProperties.PropertiesCode},#{meshDeviceProperties.DeviceCode},#{meshDeviceProperties.Name}," +
            "#{meshDeviceProperties.Value},#{meshDeviceProperties.UpdateTime})")
    int insert(@Param("meshDeviceProperties") MeshDeviceProperties meshDeviceProperties);


    @Select("select * from mesh_device_properties where DeviceCode=#{deviceCode}")
    List<MeshDeviceProperties> getListByDeviceCode(@Param("deviceCode") String deviceCode);
}
